package com.ruoyi.workbench.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.workbench.domain.WorkMatter;
import com.ruoyi.workbench.domain.WorkUserMatter;
import com.ruoyi.workbench.mapper.WorkUserMatterMapper;
import com.ruoyi.workbench.service.IWorkUserMatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户收藏事项(WorkUserMatter)表服务实现类
 *
 * @author Guojl
 * @since 2024-07-06
 */
@Service("workUserMatterService")
public class WorkUserMatterServiceImpl implements IWorkUserMatterService {

    @Autowired
    private  WorkUserMatterMapper workUserMatterMapper;

    @Override
    public List<WorkMatter> getList(WorkUserMatter workUserMatter) {
        workUserMatter.setUserId(SecurityUtils.getUserId());
        return workUserMatterMapper.getList(workUserMatter);
    }

    @Override
    public int insert(WorkUserMatter workUserMatter) {
        workUserMatter.setUserId(SecurityUtils.getUserId());
        return workUserMatterMapper.insert(workUserMatter);
    }

    @Override
    public int deleteByUserIdAndMatterId(WorkUserMatter workUserMatter) {
        workUserMatter.setUserId(SecurityUtils.getUserId());
        return workUserMatterMapper.deleteByUserIdAndMatterId(workUserMatter);
    }
}
